﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using eProject.Business;

namespace eProject.Web.UI.Admin
{
    public partial class CompanyManagementAddNew : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.Load += new EventHandler(this.Page_Load);
            this.btnSubmit.ServerClick += new EventHandler(btnSubmit_Click);
            this.btnReset.ServerClick += new EventHandler(btnReset_Click);
        }
        public void btnReset_Click(object sender, EventArgs e)
        {
            txtAddressCompany.Text = "";
            txtCompanyName.Text = "";
            txtDescription.Text = "";
            txtEmail.Text = "";
            txtPhoneNumber.Text = "";

        }
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            Company com = new Company();
            com.Name = txtCompanyName.Text.Trim().ToString();
            com.Address = txtAddressCompany.Text.Trim().ToString();
            com.Email = txtEmail.Text.Trim().ToString();
            com.Discription = txtDescription.Text.Trim().ToString();
            com.PhoneNumber = txtPhoneNumber.Text.Trim().ToString();
            com.IsDeleted = false;
            com.LastUpdate = DateTime.Now;
            com.CreatedDate = DateTime.Now;
            com.Save();

            Response.Redirect("~/Admin/CompanyManagementProgram.aspx");
        }
    }
}